package com.mx.recycle_demo.adapt

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.mx.recycle_demo.R
import com.mx.recycleview.base.BaseSimpleAdapt
import kotlinx.android.synthetic.main.adapt_auto_height.view.*

class AutoHeightAdapt(list: ArrayList<Int>) : BaseSimpleAdapt<Int>(list) {
//    override fun getItemCount(): Int {
//        return if (list.isNotEmpty()) Int.MAX_VALUE else list.size
//    }
//
//    override fun getItem(position: Int): Int? {
//        return list.getOrNull(position % list.size)
//    }

    override fun createItem(inflater: LayoutInflater, parent: ViewGroup, viewType: Int): View {
        return inflater.inflate(R.layout.adapt_auto_height, parent, false)
    }

    override fun bindView(position: Int, itemView: View, record: Int) {
        itemView.image.setImageResource(record)
        itemView.indexTxv.text = "$position"
    }
}